﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FlexLib.RegistryTree
{
	public class RegProperty
	{
		public RegProperty() { }

		public RegProperty(string name, string value, RegValueType type)
		{
			this.name = name;
			this.value = value;
			this.type = type;
		}

		private string name;
		public string Name
		{
			get { return name; }
			set { name = value; }
		}

		private string value;
		public string Value
		{
			get { return this.value; }
			set { this.value = value; }
		}

		public enum RegValueType
		{
			REG_SZ,
			REG_BINARY,
			REG_DWORD,
			REG_QWORD,
			REG_MULTI_SZ,
			REG_EXPAND_SZ
		}

		private RegValueType type;
		public RegValueType Type
		{
			get { return type; }
			set { type = value; }
		}

		public static RegValueType GetTypeByName(string name)
		{
			switch (name)
			{
				case "REG_SZ":
					return RegValueType.REG_SZ;
					
				case "REG_BINARY":
					return RegValueType.REG_BINARY;
					
				case "REG_DWORD":
					return RegValueType.REG_DWORD;
					
				case "REG_QWORD":
					return RegValueType.REG_QWORD;
					
				case "REG_MULTI_SZ":
					return RegValueType.REG_MULTI_SZ;
					
				case "REG_EXPAND_SZ":
					return RegValueType.REG_EXPAND_SZ;
					
				default:
					return RegValueType.REG_SZ;
			}
		}
	}
}
